#pragma once
#include "DirectX.h"
#include "Sprite.h"
#include <fstream>
#include <iostream>
using namespace std;


//column index constant
#define IMGPATH 1
#define WIDTH 2
#define HEIGHT 3
#define SPRITEPERROW 4
#define COUNT 5
#define ANIRATE 6


class CResourceManager
{
protected:
	DirectX *_directX;
	LPCWSTR _resourceConfigPath;

	LPDIRECT3DTEXTURE9* _textureList;
	Sprite** _spriteList;
	char** _imagePathList;
	//int _spriteInfo[150][8];
	int** _spriteInfo;

	int _numResource;

public:
	CResourceManager(){};
	CResourceManager(DirectX *dx, LPCWSTR resourcepath);
	~CResourceManager(void);
	
	void LoadImagePath();
	void LoadConfig();
	void LoadResource();

	LPDIRECT3DTEXTURE9 getTexture(int resourceName);
	Sprite* getSprite(int resourceName);

	char* getConstantName(int Constant);
	/*LPDIRECT3DTEXTURE9 getMarioTexture();*/
	void ReadLinkResource();

public:
	//SPRITE CONSTANT
	static const int BACKGROUND = 0;

	static const int MARIOSTANDLEFT1 = 1;
	static const int MARIOSTANDRIGHT1 = 2;
	static const int MARIOMOVELEFT1 = 3;
	static const int MARIOMOVERIGHT1 = 4;
	static const int MARIOJUMPLEFT1 = 5;
	static const int MARIOJUMPRIGHT1 = 6;

	static const int MARIOSTANDLEFT2 = 7;
	static const int MARIOSTANDRIGHT2 = 8;
	static const int MARIOMOVELEFT2 = 9;
	static const int MARIOMOVERIGHT2 = 10;
	static const int MARIOJUMPLEFT2 = 11;
	static const int MARIOJUMPRIGHT2 = 12;

	static const int MARIOSTANDLEFT3 = 13;
	static const int MARIOSTANDRIGHT3 = 14;
	static const int MARIOMOVELEFT3 = 15;
	static const int MARIOMOVERIGHT3 = 16;
	static const int MARIOJUMPLEFT3 = 17;
	static const int MARIOJUMPRIGHT3 = 18;

	static const int GOMBAMOVE = 19;
	static const int GOMBAPUSHED = 20;
	static const int GOMBADIE = 21;

	static const int TURBLEMOVELEFT = 22;
	static const int TURBLEMOVERIGHT = 23;
	static const int TURBLEPUSHED = 24;
	static const int TURBLEDIE = 25;

	static const int BRICK = 26;
};

